package cn.hyy.controller;

import cn.hyy.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class RibbonController {
    @Autowired
    private RestTemplate restTemplate;
    @GetMapping("/ribbon/{id}")
    public User testConsumer(@PathVariable("id") Long id){
        User user = restTemplate.getForObject("http://SERVICE-PROVIDER/user/"+id, User.class);
        System.out.println("user===="+user);
        return user;
    }
}
